package com.dwz.test.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.dwz.test.vo.Staff;

/**
 * Servlet implementation class UIServlet
 */
public class UIServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String ui = request.getParameter("ui");
		Staff staff = (Staff) request.getSession().getAttribute("staff");
		if(staff!=null){
			if("indexUI".equals(ui)){
				request.getRequestDispatcher("WEB-INF/jsp/index.jsp").forward(request, response);
			}
			 if("msgboxUI".equals(ui)){
				 request.getRequestDispatcher("WEB-INF/jsp/msgbox.jsp").forward(request, response);
			 }
		}else{
			request.getRequestDispatcher("index.jsp").forward(request, response);
		}
	}
}
